package com.inspur.icity.bus.base.core.util;

import com.fasterxml.jackson.core.Version;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.github.miemiedev.mybatis.paginator.domain.PageList;
import com.github.miemiedev.mybatis.paginator.jackson2.PageListJsonSerializer;
import com.inspur.icity.bus.base.core.geo.OnTheEarth;

import java.util.Map;


public class CustomJsonMapper extends ObjectMapper {

    public CustomJsonMapper() {
        SimpleModule pageListJSONModule = new SimpleModule("PageListJSONModule", new Version(1, 0, 0, null, null, null));
        pageListJSONModule.addSerializer(PageList.class, new PageListJsonSerializer());
        registerModule(pageListJSONModule);

        SimpleModule onTheEarthJSONModule = new SimpleModule("OnTheEarthJSONModule", new Version(1, 0, 0, null, null, null));
        onTheEarthJSONModule.addSerializer(OnTheEarth.class, new OnTheEarthJsonSerializer());
        registerModule(onTheEarthJSONModule);

        SimpleModule onTheEarthMapJSONModule = new SimpleModule("OnTheEarthMapJSONModule", new Version(1, 0, 0, null, null, null));
        onTheEarthJSONModule.addSerializer(Map.class, new OnTheEarthMapJsonSerializer());
        registerModule(onTheEarthMapJSONModule);

    }
}